﻿using System;
using System.Linq;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Taxonomy;
using System.Xml.Linq;
using System.IO;

namespace SPMetadataManager.Taxonomy.TestDriver
{
    public class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite(@"http://ashwinmsft:5643/sites/ContentTypeHub2"))
            {
                TaxonomySession session = new TaxonomySession(site);

                string text = File.ReadAllText(@"C:\taxonomy.xml");

                XElement termStoreCollectionElement = XElement.Parse(text);

                Importer importer = new Importer();
                XElement termStoreElement = termStoreCollectionElement.Elements().First();
                importer.ImportTermStore(session.TermStores, termStoreElement , true);
               
            }
        }
    }
}
